package com.monkey.model.monkey;

import com.monkey.generator.model.TMonkey;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import static com.monkey.service.MonkeyService.MONKEY_STATUS_NORMAL;

/**
 * desc:
 * auth: chenxiaobin
 * data: 2018/1/10.
 */
public class Monkey {
    private TMonkey monkey;
    private int id;
    private int userId;
    private int status; // 正常0，喂食1，交易2，交配3
    private int data1;
    private int feedCount; // 喂食次数
    private int feedMoney; // 喂食金额
    private String feedTime; // 喂食日期
    private boolean initFeed; // 是否初始化
    private boolean initBonus; // 是否初始化
    private boolean initFamily; // 是否初始化
    private boolean initSynthesise; // 是否初始化
    private List<MonkeyFeed> feeds; // 喂养历史
    private List<MonkeyBonus> bonuses; // 掘金历史
    private List<MonkeyReproduct> families; // 族谱
    private List<MonkeySynthesise> synthesises; // 合成历史
    private int element; // 五行

    public Monkey(TMonkey monkey) {
        this.monkey = monkey;
        this.id = monkey.getMonkeyid();
        this.userId = 0;
        this.status = MONKEY_STATUS_NORMAL;
        this.data1 = 0;
        this.feedCount = 0;
        this.feedMoney = 0;
        this.feedTime = "";
        this.initFeed = false;
        this.initBonus = false;
        this.initFamily = false;
        this.initSynthesise = false;
        this.feeds = new ArrayList<>();
        this.bonuses = new ArrayList<>();
        this.families = new ArrayList<>();
        this.synthesises = new ArrayList<>();
        this.element = monkey.getElement();
    }

    public int getElement() {
		return element;
	}

	public void setElement(int element) {
		this.element = element;
	}

	public int getId() {
        return id;
    }

    public void setUserInfo(int userId) {
        this.userId = userId;
    }

    public int getUserId() {
        return userId;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getData1() {
        return data1;
    }

    public void setData1(int data1) {
        this.data1 = data1;
    }

    public int getFeedCount() {
        synchronized (this) {
            return feedCount;
        }
    }

    public void setFeedCount(int feedCount) {
        synchronized (this) {
            this.feedCount = feedCount;
        }
    }

    public int getFeedMoney() {
        synchronized (this) {
            return feedMoney;
        }
    }

    public void setFeedMoney(int feedMoney) {
        synchronized (this) {
            this.feedMoney = feedMoney;
        }
    }

    public String getFeedTime() {
        return feedTime;
    }

    public void setFeedTime(String feedTime) {
        this.feedTime = feedTime;
    }

    public int getDadId() {
        return monkey.getDadid();
    }

    public void setDadId(int dadid) {
        monkey.setDadid(dadid);
    }

    public int getMonId() {
        return monkey.getMonid();
    }

    public void setMonId(int monid) {
        monkey.setMonid(monid);
    }

    public int getGeneration() {
        return monkey.getGeneration();
    }
    
    public int getWeight() {
        synchronized (this) {
            return monkey.getWeight();
        }
    }

    public void setWeight(int weight) {
        synchronized (this) {
            monkey.setWeight(weight);
        }
    }

    public int getGrowOrigin() {
        return monkey.getGroworigin();
    }

    public int getReproductOrigin() {
        return monkey.getReproductorigin();
    }

    public int getBonusOrigin() {
        return monkey.getBonusorigin();
    }

    public int getGrow() {
        synchronized (this) {
            return monkey.getGrow();
        }
    }

    public void setGrow(int grow) {
        synchronized (this) {
            monkey.setGrow(grow);
        }
    }

    public int getReproduct() {
        synchronized (this) {
            return monkey.getReproduct();
        }
    }

    public void setReproduct(int reproduct) {
        synchronized (this) {
            monkey.setReproduct(reproduct);
        }
    }

    public int getBonus() {
        synchronized (this) {
            return monkey.getBonus();
        }
    }

    public void setBonus(int bonus) {
        synchronized (this) {
            monkey.setBonus(bonus);
        }
    }

    public int getReproductCount() {
        synchronized (this) {
            return monkey.getReproductcount();
        }
    }

    public void setReproductCount(int reproductcount) {
        synchronized (this) {
            monkey.setReproductcount(reproductcount);
        }
    }

    public Date getReproductCD() {
        synchronized (this) {
            return monkey.getReproductcd();
        }
    }

    public void setReproductCD(Date reproductcd) {
        synchronized (this) {
            monkey.setReproductcd(reproductcd);
        }
    }

    public int getBonusCount() {
        return monkey.getBonuscount();
    }

    public void setBonusCount(int bonuscount) {
        monkey.setBonuscount(bonuscount);
    }

    public BigDecimal getBonusYesterday() {
        return monkey.getBonusyesterday();
    }

    public void setBonusYesterday(BigDecimal bonusyesterday) {
        monkey.setBonusyesterday(bonusyesterday);
    }

    public BigDecimal getBonusTotal() {
        return monkey.getBonustotal();
    }

    public void setBonusTotal(BigDecimal bonustotal) {
        monkey.setBonustotal(bonustotal);
    }

    public String getUuid() {
        return monkey.getUuid();
    }

    public Date getCreateTime() {
        return monkey.getCreatetime();
    }

    public boolean isInitFeed() {
        return initFeed;
    }

    public void setInitFeed(boolean initFeed) {
        this.initFeed = initFeed;
    }

    public boolean isInitBonus() {
        return initBonus;
    }

    public void setInitBonus(boolean initBonus) {
        this.initBonus = initBonus;
    }

    public boolean isInitFamily() {
        return initFamily;
    }

    public void setInitFamily(boolean initFamily) {
        this.initFamily = initFamily;
    }

    public List<MonkeyFeed> getFeeds() {
        return feeds;
    }

    public List<MonkeyBonus> getBonuses() {
        return bonuses;
    }

    public List<MonkeyReproduct> getFamilies() {
        return families;
    }
    
    public List<MonkeySynthesise> getSynthesises() {
        return synthesises;
    }
    
    public boolean isInitSynthesise() {
        return initSynthesise;
    }

    public void setInitSynthesise(boolean initSynthesise) {
        this.initSynthesise = initSynthesise;
    }
}
